package com.suke.czx.modules.contract.entity;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.suke.czx.common.validate.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 应用模块名称: 合同
 * 代码描述: 合同实体
 * copyright: AUZAR ALL RIGHTS RESERVED
 * company: AUZAR
 *
 * @author: 颜米晨
 * @date: 2021/09/07 20:36:48
 */
@Data
@ApiModel(value = "合同管理")
@EqualsAndHashCode(callSuper = true)
public class Contract extends Model<Contract> {

    @ApiModelProperty(value = "合同id")
    @TableId(value = "contract_id", type = IdType.AUTO)
    @NotNull(groups = {ContractUpdateGroup.class}, message = "合同编码不能为空")
    public Long contractId;

    @ApiModelProperty(value = "项目Id")
    public Long projectId;

    @ApiModelProperty(value = "合同名称")
    @NotBlank(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "合同名称不能为空")
    public String contractName;

    @ApiModelProperty(value = "合同类型 1-项目合同 2-采购合同")
    @NotNull(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "合同类型不能为空")
    @EnumValue(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, intValues = {1, 2}, message = "合同类型只能是1,2")
    public Integer contractType;

    @TableField(exist = false)
    @ApiModelProperty(value = "合同类型名称")
    public String contractTypeName;

    @ApiModelProperty(value = "甲方")
    @NotBlank(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "甲方不能为空")
    public String firstParty;

    @ApiModelProperty(value = "甲方负责人")
    @NotBlank(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "甲方负责人不能为空")
    public String firstPartyPerson;

    @ApiModelProperty(value = "甲方联系方式")
    @NotBlank(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "甲方联系方式不能为空")
    public String firstPartyContactWay;

    @ApiModelProperty(value = "乙方")
    @NotBlank(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "乙方不能为空")
    public String secondParty;

    @ApiModelProperty(value = "乙方负责人")
    @NotBlank(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "乙方负责人不能为空")
    public String secondPartyPerson;

    @ApiModelProperty(value = "乙方联系方式")
    @NotBlank(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "乙方联系方式不能为空")
    public String secondPartyContactWay;

    @ApiModelProperty(value = "违约责任")
    public String breachLiability;

    @ApiModelProperty(value = "签订日期")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @NotNull(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "签订日期不能为空")
    public Date signDate;

    @ApiModelProperty(value = "交付日期")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @NotNull(groups = {ContractSaveGroup.class, ContractUpdateGroup.class}, message = "交付日期不能为空")
    public String deliveryDate;

    @ApiModelProperty(value = "合同金额")
    public BigDecimal money;

    @ApiModelProperty(value = "附件ids")
    public String fileIds;

    @ApiModelProperty(value = "备注")
    public String note;

    @ApiModelProperty(value = "删除标记  0：删除   1：正常")
    public Integer del;

    @ApiModelProperty(value = "创建者id")
    public Long creator;

    @ApiModelProperty(value = "创建时间")
    public Date createTime;

    @ApiModelProperty(value = "更新者id")
    public Long updater;

    @TableField(exist = false)
    @ApiModelProperty(value = "更新人姓名")
    public String updaterName;

    @ApiModelProperty(value = "更新时间")
    public Date updateTime;

}
